package com.js.basic.enums;

import io.swagger.models.auth.In;

public enum DateEnum {
    YYYY_MM_DD_hh_mm_ss(1, "年月日时分秒"),
    YYYY_MM_DD_hh_mm(2, "年月日时分"),
    YYYY_MM_DD(3, "年月日"),
    ;

    private final Integer code;
    private final String info;


    DateEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static DateEnum getEnumByValue(int value) {
        for (DateEnum dateEnum : values()) {
            if (dateEnum.getCode() == value) {
                return dateEnum;
            }
        }
        throw new IllegalArgumentException("Invalid enum value:" + value);
    }

    public static void main(String[] args) {
        System.out.println(DateEnum.getEnumByValue(1));
    }
}
